package dbobj

import (
	"gorm.io/datatypes"
	//"gorm.io/gorm"
)

type ThingAlarmRule struct {
	ThingID            string         `gorm:"type:varchar(40);primaryKey;not null;" json:"thing_id"`
	AlarmConditionRule datatypes.JSON `json:"alarm_condition_rules"`
	AlarmTimeRule      datatypes.JSON `json:"alarm_time_rules"`
}

//AlarmShield 告警过滤
type AlarmShield struct {
	UID        int64  `gorm:"primaryKey;AUTO_INCREMENT;not null" json:"uid"`
	TargetType string `gorm:"uniqueIndex:sindex" json:"target_type"` //"model","thing","station"
	TargetID   string `gorm:"uniqueIndex:sindex" json:"target_id"`
	AlarmID    string `gorm:"not null;uniqueIndex:sindex" json:"alarm_id"`
	//Mindex     string `gorm:"not null;uniqueIndex:sindex" json:"m_index"`
	//SType          string         `gorm:"not null;uniqueIndex:sindex" json:"s_type"` //"week","month"
	//Days           string         `gorm:"not null;uniqueIndex:sindex" json:"days"`
	TimeSpanShield datatypes.JSON `json:"time_span_shield"`
}

//GetID() interface{}
//GetName() string
//AutoID()
func (pShield *AlarmShield) GetID() interface{} {
	return pShield.UID
}

func (pShield *AlarmShield) AutoID() {

}
